package com.mt;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;

@EnableEurekaClient
@EnableFeignClients(basePackages = {"com.mt.channel.feign","com.mt.customer.feign"})
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class ChannelAdminApplication extends SpringBootServletInitializer {
//    @Bean
//    public CorsWebFilter corsWebFilter(){
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        CorsConfiguration corsConfiguration = new CorsConfiguration();
//        corsConfiguration.addAllowedHeader("*");
//        corsConfiguration.addAllowedMethod("*");
//        corsConfiguration.addAllowedOrigin("*");
//        corsConfiguration.setAllowCredentials(true);
//        source.registerCorsConfiguration("/**",corsConfiguration);// "/**"所以的路径
//        return new CorsWebFilter(source);
//    }
    public static void main(String[] args) {
        SpringApplication.run(ChannelAdminApplication.class, args);
    }

}